using System;
using System.Text.RegularExpressions;

namespace ZLDC.Common
{
    public class Judgedigit
    {
        public Judgedigit()
        {
        }

        public static bool IsNumber(String strNumber)
        {
            Regex NumberPattern = new Regex("[^0-9.-]");
            return !NumberPattern.IsMatch(strNumber);
        }

        public static bool IsDate(String strDate)
        {
            string strRegex = @"^(([0-9][0-9][0-9][0-9])-(([0][1-9])|([1][0-2]))-(([0][1-9])|([1-2][0-9])|([3][0-1])))$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(strDate))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool IsLetterAndNum(String strLetterAndNum)
        {
            string strRegex = @"^([A-Za-z][A-Za-z][A-Za-z][A-Za-z][0-9][0-9][0-9][0-9][0-9][0-9][0-9])$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(strLetterAndNum))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool IsLetterCkCONo(String strLetterAndNum)
        {
            string strRegex = @"^([A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9][0-9][0-9])$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(strLetterAndNum))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool IsCBP(String StrCBP)
        {
            string strRegex = @"^(([0-9][0-9][0-9][0-9][0-9][0-9])-([0-9][0-9][0-9][0-9][0-9]))$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(StrCBP))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool IsEIN(String StrEIN)
        {
            string strRegex = @"^(([0-9][0-9])-([0-9][0-9][0-9][0-9][0-9][0-9][0-9]))$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(StrEIN))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool IsEIN2(String StrEIN)
        {
            string strRegex = @"^(([0-9][0-9])-([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0][0]))$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(StrEIN))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool IsSSnumber(String StrSSnumber)
        {
            string strRegex = @"^(([0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9][0-9][0-9]))$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(StrSSnumber))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
